$(function() {
searchAllApp();
initTable();
});

/**
* 初始化表格
*/
function initTable() {
$('#curr_hot_keyTable').DataTable({
language: Language,
columns: [
        {
        "data": "appName",
        "title": "app名称"
        },
        {
        "data": "key",
        "title": "key"
        },
        {
        "data": "expireTime",
        "title": "剩余过期时间（秒）",
        "render": function (data, type, row, meta) {
                if (data <= 0) {
                        return "已过期"
                } else {
                        return data
                }
        }
        }
],
dom: 'rt<"bottom"ilp><"clear">',
destroy : true,
searching: false,
processing : true,
serverSide: true,
bSort: false,
lengthMenu: [10],
autoWidth: false,


ajax: {
type: "post",
contentType: "application/json",
headers: getHeaders(),
url: searchUrl,
dataFilter: dataFilterFunc,
data: function(param) {
let json = $("#curr_hot_keyForm").serializeObject()
json.type = 0;
json.pageNum = param.start / 10 + 1;
json.pageSize = param.length;
json.orderByKey = "id"
return JSON.stringify(json)
},
error: errorFunc
}
});
}

/**
* 查询
*/
function search() {
reloadTable('curr_hot_keyTable');
}

/**
* 重置
*/
function reset() {
clearForm();

search();
}

/**
* 清空表单
*/
function clearForm() {
resetForm("curr_hot_keyForm")
}


